//同步函数，修改state
export default {
  add(state, payload) {
    console.log(payload)
    state.count+=1
  },

  setSelectedProvince(state, province) {
      state.selectedProvince = province;

    },
    setCityData(state,data)
    {
     state.cityData = data;
    },
    setEmotionsData(state, data) {
      state.emotionsData = data;

    },

    //修改此时的state数据
  SelectPoems(state, title) {
    state.selectedPoem = title;
    state.showDuFuIntro = false;
  },
  //此时会让杜甫简介显示
  resetSelection(state) {
    state.selectedPoem = null;
    state.showDuFuIntro = true;

    state.poemLocation = null;  
  },
  //是否进入封面
  Enter(state) {
    state.isFengMian = true
  },

  
 //修改第二页经纬度!!!
  setPoemLocation(state, coordinates) {
    state.poemLocation = coordinates;
  }, 
  
  

  //省份介绍
  SelectRegion(state, regionName) {
      state.selectedRegion = regionName; // 更新选中的地区
    },


  
    //设置当前轨迹事件
  SetCurrentEvent(state, event) {  
  state.currentEvent = event; // 设置当前事件  
},  
  // 清理当前事件  
  ClearCurrentEvent(state) {
    state.currentEvent = null; 
  },  
  // 设置上一个已知事件 
  SetLastEvent(state, event) {
    state.lastEvent = event; // 设置上一个已知事件  
  },  



  //更新第二页古诗名字
  // setPoem(state, poem) {
  //   state.poem = poem;
  // },
  
  //匹配第二页的地图
  // setSelectedPoem(state, title) {
  //   state.selectedPoem = title;
  //   const foundPoem = data.find(item => item.title === title);
  //   if (foundPoem) {
  //     state.poemLocation = {
  //       name: foundPoem.place,
  //       time: foundPoem.time,
  //       coordinates: foundPoem.coordinates,
  //     };
  //   }
  // },  
  
}